Skip to content

Hide dotfiles from instance content scanning#5999

Open
acorsicanfrog wants to merge 5 commits intomodrinth:mainfrom
acorsicanfrog:patch-1
Open

Hide dotfiles from instance content scanning#5999
acorsicanfrog wants to merge 5 commits intomodrinth:mainfrom
acorsicanfrog:patch-1

Conversation

@acorsicanfrog
Copy link
Copy Markdown

Prevent hidden files such as .DS_Store from being treated as valid instance content.

This updates the profile scanning logic in packages/app-lib/src/state/profiles.rs to ignore basenames that start with '.', and applies that filter consistently in both scan paths.

Fixing this:

Screenshot 2026-05-05 at 13 14 35

Prevent hidden files such as .DS_Store from being treated as valid instance content.

This updates the profile scanning logic in [packages/app-lib/src/state/profiles.rs](/Users/froggy/Downloads/code-main/packages/app-lib/src/state/profiles.rs#L420) to ignore basenames that start with '.', and applies that filter consistently in both scan paths.

Signed-off-by: Corsican Frog <49497194+acorsicanfrog@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 5, 2026 11:35
@modrinth-bot
Copy link
Copy Markdown
Member

modrinth-bot commented May 5, 2026

Pull request changelog

App

Added

Changed

Deprecated

Removed

Fixed

  • Fixed hidden files showing up in the Content tab on instances.

Security

Website

Added

Changed

Deprecated

Removed

Fixed

Security

Hosting

Added

Changed

Deprecated

Removed

Fixed

Security

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates profile content scanning in packages/app-lib so hidden dotfiles are no longer treated as installed instance content. It centralizes the ignore logic to keep the two scan paths aligned and fixes the false-positive content entries shown for files like .DS_Store.

Changes:

  • Added a shared should_ignore_project_file helper in profiles.rs.
  • Extended scan filtering to ignore basenames starting with ..
  • Reused the helper in both profile scan paths to keep behavior consistent.

@Prospector Prospector requested a review from a team May 5, 2026 17:05
Comment thread packages/app-lib/src/state/profiles.rs Outdated
Comment on lines +420 to +428
fn should_ignore_project_file(
project_type: ProjectType,
file_name: &str,
) -> bool {
file_name.starts_with('.')
|| (project_type == ProjectType::ShaderPack
&& file_name.ends_with(".txt"))
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would implement as a whitelist rather than blacklist; only process .jar and .zip and other formats I'm forgetting if any

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK done, is it better now?

Only scan supported content archives into instance content.

Accept .jar files for mods and .zip files for datapacks, resourcepacks, and shaderpacks, after trimming the .disabled suffix. 

This prevents .DS_Store and other unsupported files from appearing in the Content tab.

Signed-off-by: Corsican Frog <49497194+acorsicanfrog@users.noreply.github.com>
@acorsicanfrog acorsicanfrog requested a review from fetchfern May 6, 2026 16:48
@Prospector Prospector enabled auto-merge May 7, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants